package cn.qayy.utils;

import javax.servlet.ServletContext;

import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;
/**
 * 获取ServletContext
 * 
 * @author jobs1127
 *
 */
public class ServletContextUtils {
	static ServletContext servletContext = null;
	static WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext();

	public static ServletContext getServletContext() {
		if (servletContext == null) {
			servletContext = webApplicationContext.getServletContext();
		}
		return servletContext;
	}
}
